1. Field of the Invention
This invention relates to video data compression.
2. Description of the Prior Art
Some video data compression systems, such as systems defined by the MPEG II standard1, use a number of different coding techniques to encode successive pictures of a video signal.
1 Motion Picture Experts Group II standard, described in the ISO/IEC Publication DIS 13818/2, xe2x80x9cInformation Technologyxe2x80x94generic coding of motion pictures and associated audio informationxe2x80x9d, March 1995. 
Typically, the video signal is divided into successive groups of pictures (GOPs). Within each GOP at least one picture is encoded as an xe2x80x9cI-picturexe2x80x9d, or intra-picture, using only information present in that picture itself. This means that I-pictures can later be decoded without requiring information from other pictures, and so provide random entry points into the video sequence. However, the converse of this is that the encoding of I-pictures cannot make use of the similarity between successive pictures, and so the degree of data compression obtained with I-pictures is only moderate.
Further pictures within each GOP may be encoded as xe2x80x9cP-picturesxe2x80x9d or predicted pictures. P-pictures are encoded with respect to the nearest previous I-picture or P-picture, so that only the differences between a P-picture and the previous P- or I-picture needs to be transmitted. Also, motion compensation is used to encode the differences, so a much higher degree of compression is obtained than with I-pictures.
Finally, some of the pictures within a GOP may be encoded as xe2x80x9cB-picturesxe2x80x9d or bidirectional pictures. These are encoded with respect to two other pictures, namely the nearest previous I- or P-picture and the nearest following I- or P-picture. B-pictures are not used as references for encoding other pictures, so a still higher degree of compression can be used for B-pictures because any coding errors caused by the high compression will not be propagated to other pictures.
Therefore, in each GOP there are (up to) three classes of picture, I-, P- and B-pictures, which tend to achieve different degrees of compression and so tend to require different shares of the overall available encoded bit stream. Generally, I-pictures require a large share of the available transmission or storage capacity, followed by P-pictures, and followed by B-pictures.
However, this is only a general rule, and while the trends might remain the same, the number of bits required to achieve an equal subjective quality of encoding for the pictures in a GOP may vary from GOP to GOP. Any errors in the allocation of transmission or storage capacity between pictures can lead to uneven or reduced subjective quality of the encoded frames, because errors, artifacts and noise due to compression will not be distributed evenly between the frames of the GOP.
It has been proposed to allocate shares in the available encoded bitstream to individual pictures within a GOP on the basis of the degree of compression obtained for corresponding pictures in a preceding GOP.
It is a constant aim in the field of video compression to improve the subjective quality of the encoded (and subsequently decoded) images.
This invention provides video data compression apparatus in which successive groups of two or more images are encoded subject to a predetermined limit on the quantity of output encoded data to be generated for each group of images, the apparatus comprising:
a trial encoder for encoding at least a subset of images of a current group of images to generate trial-encoded data for each trial-encoded image;
a data quantity allocator, responsive to the quantities of trial-encoded data generated by the trial encoder, for allocating respective quantities of output encoded data for each image in the group of images; and
a final encoder for encoding each image of the group of images in accordance with the quantities of output encoded data allocated to that image by the data quantity allocator.
The invention recognises that even the technique described above in which shares in the available encoded bitstream are allocated to individual pictures within a current GOP on the basis of the degree of compression obtained for corresponding pictures in a preceding GOP does not necessarily lead to a satisfactory prediction of the quantity of encoded data which will be required to encode each picture of the current GOP to a substantially equal subjective standard. For example, because difference data (representing a motion-compensated difference between that picture and one or more reference pictures) is encoded for P- and B- frames, if a scene change occurs during the current GOP, the frame at which the scene change occurs will have a great deal of difference data and will require a larger number of bits to encode to a standard similar to that of other pictures in the GOP.
The invention addresses this problem by providing at least a partial rehearsal of the encoding of pictures within a GOP. In other words, at least some (and possibly all) of the pictures within a GOP are subjected to a trial encoding stage before being passed to a final encoding stage. The trial encoding stage does not need to assess the actual number of bits which will be required to encode each picture (bearing in mind any overall limit for each GOP imposed by the storage or transmission channel to be used), but is used merely to assess the relative proportions of the overall bitstream to be allocated to each picture.
In one embodiment, to save on hardware requirements, a single encoder may be operable alternately for each group of images as the trial encoder and the final encoder. If operation is required in real time, then preferably the single encoder is operated as both the trial encoder and the final encoder for a group of images during a time period equal to a display period of the group of images.
In one embodiment the trial and final encoders are full encoders, using decoded versions of one or more other trial-encoded or final-encoded images in the group of images. However, since the trial encoding is performed to assess the relative data requirements of the images in the group, processing resources can advantageously be saved by using input (rather than decoded) images in the trial encoder.
In one embodiment, for accuracy of operation of the data quantity allocator, the trial encoder is operable to trial-encode all of each group of images. In this case, preferably the data quantity allocator is operable to allocate quantities of output encoded data to each image of the group of images in proportion to the respective quantities of trial-encoded data for each image.
However, for economy of processing time or resources, in another embodiment the trial encoder is operable to trial-encode a subset of each group of images. In this case, preferably the data quantity allocator is operable to allocate quantities of output encoded data to each trial-encoded image of the group of images in proportion to the respective quantities of trial-encoded data for those images, and to allocate output encoded data to each non-trial encoded image of the group of images in proportion to the total quantity of trial-encoded data generated for that group and a respective predetermined ratio associated with each non-trial-encoded image of the group.
Preferably the trial encoder comprises a stage of data quantising, the data quantising stage operating using a predetermined degree of quantisation for each image in the group of images.
It is preferred that the predetermined degree of quantisation is selected to provide harsher quantisation of images in the group not used as reference images in the encoding of other images. This tends to lead to a greater data quantity allocation to images which are used as references for other images, thus tending to improve their subjective quality. However, although it may be expected that the subjective quality of the more harshly quantised images would then suffer, in fact, because the reference images are better, the non-reference images can also improve. Thus by the counter-intuitive step of quantising the non-reference images more harshly, all of the images"" quality can potentially be improved.
The invention also provides a method of video data compression apparatus in which successive groups of two or more images are encoded subject to a predetermined limit on the quantity of output encoded data to be generated for each group of images, the method comprising the steps of:
trial-encoding at least a subset of images of a current group of images to generate trial-encoded data for each trial-encoded image;
allocating respective quantities of output encoded data for each image in the group of images in response to the quantities of trial-encoded data generated by trial-encoding; and
final-encoding each image of the group of images in accordance with the quantities of output encoded data allocated to that image by the data quantity allocator.